package com.lgcns.android.otmeal;

import android.app.ListActivity;
import android.app.ProgressDialog;

/**
 * @author Jiyun Kang
 */
public abstract class AbstractAsyncListActivity extends ListActivity implements AsyncActivity
{	
	protected static final String TAG = AbstractAsyncActivity.class.getSimpleName();

	private ProgressDialog _progressDialog;
	
	private boolean _destroyed = false;

	
	//***************************************
    // Activity methods
    //***************************************
	@Override
	protected void onDestroy() 
	{
		super.onDestroy();
		_destroyed = true;
	}
	
	
	//***************************************
    // Public methods
    //***************************************
	public void showLoadingProgressDialog() 
	{
		this.showProgressDialog("Loading. Please wait...");
	}
	
	public void showProgressDialog(CharSequence message) 
	{
		_progressDialog = ProgressDialog.show(this, "",  message, true);
	}
		
	public void dismissProgressDialog() 
	{
		if (_progressDialog != null && !_destroyed) 
		{
			_progressDialog.dismiss();
		}
	}
}
